package com.sgb.kjwl.view.ui.adapter.category;

import android.content.Context;
import android.graphics.Typeface;
import android.view.View;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ItemCategoryLeftBinding;
import com.swgk.core.view.entity.MenuEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class CategoryLeftAdapter extends BaseRecycleAdapter<MenuEntity<MenuEntity<MenuEntity>>> {
    private int poinsion = -1;

    public CategoryLeftAdapter(Context context, List<MenuEntity<MenuEntity<MenuEntity>>> datas) {
        super(context, R.layout.item_category_left, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, MenuEntity<MenuEntity<MenuEntity>> entity) {
        holder.setBinding(BR.viewModel, entity);
        boolean selected = holder.itemView.isSelected();
        ((ItemCategoryLeftBinding) holder.getmBinding()).categoryMark.setVisibility(selected ? View.VISIBLE : View.INVISIBLE);
        if (selected) {
            ((ItemCategoryLeftBinding) holder.getmBinding()).tvName.setTypeface(null, Typeface.BOLD);
        } else {
            ((ItemCategoryLeftBinding) holder.getmBinding()).tvName.setTypeface(null, Typeface.NORMAL);
        }
    }
}
